#include "gmock/gmock.h"
#include "BTree.h"
#include "BTreeNode.h"

using namespace LQLib;
using namespace testing;

TEST(BTree, creat) {
	BTree<int> tt;
	BTreeNode<int> tn;
}

TEST(BTree, insert) {
	BTree<int> bt;
	bt.insert(1,nullptr);

	auto n = bt.find(1);
	bt.insert(2, n);
	bt.insert(3, n);

	n = bt.find(2);
	bt.insert(4, n);
	bt.insert(5, n);

	n = bt.find(3);
	bt.insert(6, n);
	bt.insert(7, n);

	n = bt.find(4);
	bt.insert(8, n);
	bt.insert(9, n);

	n = bt.find(5);
	bt.insert(10, n);

	//n = bt.find(6);
	//bt.insert(11, n, BTNodePos::left);

	for (bt.begin(); !bt.end(); bt.next()) {
		std::cout << bt.current() << " ";
	}
	std::cout << "\n";

	auto queue = bt.traversal(BTTraversal::InOrder);
	for (auto it : queue) {
		std::cout << it->value << ' ';
	}
	std::cout << "\n";
}